package org.subside;

import org.springframework.core.task.TaskExecutor;
import org.subside.thread.ThreadPoolFactory;

import java.util.HashMap;


/**
 * @Author : zhangbo
 * @data : 2024/3/26
 * @description :
 */
public class Test {
    public static void main(String[] args) {
        test();
    }

    public static void test() {
        TaskExecutor taskExecutor = new ThreadPoolFactory().taskExecutor();

        taskExecutor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    HashMap<String, Object>map=new HashMap<>();
                    for (int i = 0; i < 100; i++) {
                        if (i / 2 == 0) {
                            System.out.println(i + "是偶数--" + "+当前线程ID:" + Thread.currentThread().getId() + Thread.currentThread().getName());
                        } else {
                            System.out.println(i + "是奇数--" + "当前线程ID:" + Thread.currentThread().getId() + Thread.currentThread().getName());
                        }
                    }
                    //终止线程
                    break;
                }
            }
        });
        taskExecutor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    for (int i = 0; i < 100; i++) {
                        if (i / 2 == 0) {
                            System.out.println(i + "是偶数--" + "+当前线程ID:" + Thread.currentThread().getId() + Thread.currentThread().getName());
                        } else {
                            System.out.println(i + "是奇数--" + "当前线程ID:" + Thread.currentThread().getId() + Thread.currentThread().getName());
                        }
                    }
                    //终止线程
                    break;
                }
            }
        });
    }
    /**
     * 查询集合
     */
}